﻿/*----------------------------------------------------------------
//文件名：BaseManagePage.cs
//文件功能描述：系统后台管理页面基类，必须登录；
//创建人：赵国伟
//创建时间：2012-03-17 17:05:05
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using Shopping.Common;
using Shopping.Model;
using Shopping.BLL;

public class BaseManagePage : System.Web.UI.Page
{
    private static readonly EmployeesManage bllEmployee = new EmployeesManage();
    protected int EmployeeID;
    protected string EmployeeName;
    protected string TrueName;
    protected int Logins;
    protected string LastLoginDate;
    protected string LastLoginIP;

    public BaseManagePage()
	{
        if (bllEmployee.IsLogin())
        {
            Employees e = bllEmployee.GetLoginStatus();
            this.EmployeeID = e.EmployeeID;
            this.EmployeeName = e.EmployeeName;
            this.TrueName = e.TrueName;
            this.Logins = e.Logins;
            this.LastLoginDate = e.LastLoginDate.ToString("yyyy-MM-dd HH:mm:ss");
            this.LastLoginIP = e.LastLoginIP;
        }
	}

    #region 重写OnLoad事件
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        if (!bllEmployee.IsLogin())
        {
            Response.Redirect("/Manage/Login.aspx?BackUrl=" + HttpUtility.UrlEncode(Request.Url.AbsoluteUri));
            Response.End();
        }
      
    }
    #endregion


}